<script> 
    FB.init({appId: "394487913951162", status: true, cookie: true});
                    
    function postToFeed() {
                    
        // calling the API ...
        var obj = {
        method: 'feed',
        link: 'http://umarket.vn',
        picture: 'http://www.umarket.vn/public/files/product/',
        caption: 'uMarket.vn',
        name: 'uMarket.vn',
        description: 'uMarket.vn - Hệ thống tổng hợp tin voucher giảm giá'
    };
                    
    function callback(response) {
        document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
    }
                    
    FB.ui(obj, callback);
    }
                        
</script>
<!--Begin All-->
    <div class="d_all">
		<!--Menu-->
                    <div class="tt_menu_2">
                    	<div class="pl20 pt10">
                            <?php echo $this->ProductCat(); ?>
                         </div>
                            <?php echo $this->render('/search_product.phtml'); ?>
                    </div>
                    
        <!--End Menu-->
    
    <!--Begin Contents-->
    <div class="d_contents_wrap_2">
    	<div class="d_space_height_10"></div>
		
        <!-- Left -->
        <div class="dd_ctsp">

        <?php echo $this->render('/banner.phtml'); ?>
        
        <?php
            if(count($this->data) > 0) :
            $product = new Default_Model_Product();
            foreach($this->data as $cat) : 
            $rows = $product->listProduct($cat['cat_id']);
                if(count($rows) > 0) :
        ?>
        
        <div class="ttct_top">
            <div class="pl20"><?php echo $cat['cat_name']; ?></div>
        </div>
        
        <div class="dd_ctsp_mid">
            <div class="pa20">
                <?php
                    foreach($rows as $value) :
                    $percent = 100 - (($value['sales_price'] / $value['original_price']) * 100);
                ?>
                <div class="product">
                    <a href="<?php echo $this->baseUrl('product/details?id=') . $value['product_id']; ?>" class="product_title"><?php echo $value['sort_name']; ?></a>
                    
                    <div class="product_image">
                        <a href="<?php echo $this->baseUrl('product/details?id=') . $value['product_id']; ?>"><img src="<?php echo $this->baseUrl('/public/files/product/') . $value['product_image']; ?>" /></a>
                        <div class="percent">
                            <p><?php echo $product->percent($percent); ?></p>
                            <span class="mini_percent">%</span>
                        </div>
                    </div>
                    
                    <div class="original_price"><strike><?php echo $product->formatMoney($value['original_price']); ?>đ</strike></div>
                    
                    <div class="sales_price"><?php echo $product->formatMoney($value['sales_price']); ?>đ</div>
                    
                    <div class="row3">
                        <div class="area_name"><?php echo $value['area_name']; ?></div>
                    </div>
                    <div class="provider_icon"><img src="<?php echo $this->baseUrl('/public/files/provider/') . $value['provider_icon']; ?>" /></div>
                    
                    <p class="provider_name"><?php echo $value['provider_name']; ?></p>
                </div>
                <?php endforeach; ?>
                
                <div class="cont">
                    <a href="<?php echo $this->baseUrl('product/category?id='). $cat['cat_id']; ?>">Xem thêm &raquo; </a>
                </div>
            </div>
        </div>
        
        <!-- End Kênh tin -->
        <div class="dd_ctsp_bot"></div>	
        <?php
            endif;
            endforeach; 
            endif;
        ?>
        </div>
        <!-- End Left -->    